/*
 * Error.cpp
 *
 *  Created on: 2011-2-25
 *      Author: hao
 */

#include "Error.h"

Error::Error( int Tag ) throw(){

	switch( Tag ){

	case ErrorTag::MAINLOOP_CREATE_FAILED:

		wData = L"Pluse audio mainloop creation failed!";

		Data = "Pluse audio mainloop creation failed!";

		break;

	case ErrorTag::GETTING_MAINLOOP_API_FAILED:

		wData = L"Failed in getting mainloop api!";

		Data = "Failed in getting mainloop api!";

		break;

	case ErrorTag::CREATE_CONTEXT_FAILED:

		wData = L"Failed in creating context!";

		Data = "Failed in creating context!";

		break;

	case ErrorTag::CONTEXT_FAILED:

		wData = L"Failed in running context!";
		Data = "Failed in running context!";

		break;

	case ErrorTag::CREATE_STREAM_FAILED:

		wData = L"Failed in creating stream!";
		Data = "Failed in creating stream!";

		break;

	case ErrorTag::STREAM_DRAIN_FAILED:
		wData = L"Failed in drain stream!";
		Data = "Failed in drain stream!";
		break;

	case ErrorTag::DECODER_PLUGIN_DISAPPEAR:
		wData = L"A plugin file disappear!";

		Data = "A plugin file disappear!";

		break;

	case ErrorTag::DECODER_LOADING_ERROR:

		wData = L"Cound't not load so file!";
		Data = "Cound't not load so file!";

		break;

	case ErrorTag::DECODER_NOT_FIX:
		wData = L"The decoder format not fix!";
		Data = "The decoder format not fix!";

	case ErrorTag::PLUGHIN_DATA_NOT_FOUND:

		wData = L"Cound't not find the plugins dir!";
	    Data = "Cound't not find the plugins dir!";

		break;

	case ErrorTag::MUSIC_FILE_NOT_FOUND:

		wData = L"Can't find the Music file!";
		Data = "Can't find the Music file!";

		break;

	case ErrorTag::UNKNOWN_FILE_TYPE:

		wData = L"Music file type unknown!";

		Data = "Music file type unknown!";

		break;

	case ErrorTag::UNKNOWN_FORMAT:

		wData = L"Music format unknown!";

		Data = "Music format unknown!";

		break;

	default:

		wData = L"No Error!";
		Data = "No Error";

	}

}

const wchar_t * Error::w_what() const{
	return wData.c_str();
}

const char * Error::what() const{

	return Data.c_str();

}

